<template>
  <div @click="handleClick" class="book-list-item">
    <img v-lazy="img">
    <h3>
      <slot name="book"></slot>
    </h3>
    <p>
      <slot name="author"></slot>
    </p>
    <p>
      <slot name="desc"></slot>
    </p>
  </div>
</template>

<script>
export default {
  props: {
    img: String,
    path: String,
  },
  methods: {
    handleClick() {
      this.$router.push({
        name: 'bookeDetailView',
        params: {
          path: this.path
        }
      })
    }
  }
}
</script>

<style>
.book-list-item img {
  float: left;
  width: 82px;
  height: 115px;
  margin-right: 15px;
  border-radius: 4px;
  box-shadow: 2px 1px 5px 0px rgba(0, 0, 0, .2);
}

.book-list-item h3 {
  font-weight: normal;
  font-size: 17px;
  color: #222;
  height: 20px;
  line-height: 20px;
  overflow: hidden;
  margin-bottom: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-list-item p {
  font-size: 12px;
  color: #999;
}

.book-list-item p:nth-of-type(1) {
  line-height: 16px;
  height: 16px;
  margin-bottom: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.book-list-item p:nth-of-type(2) {
  line-height: 18px;
  height: 54px;
  -webkit-line-clamp: 3;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
</style>